package com.example.tests;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.Random;

public class RandomDate {
	
	int year;
	String month;
	int day;
	
	public RandomDate(){
		Calendar calendar = Calendar.getInstance(Locale.ENGLISH);
		// Get year
		year = generateRandomNumberInRange(1970, 2000);
		// Get number of month
		int m = generateRandomNumberInRange(1, 12);
		calendar.set(year, m, 1);
		// Get name Month
		Date d = new Date(calendar.getTimeInMillis());
		month = new SimpleDateFormat("MMMM", Locale.ENGLISH).format(d);
		
		// Get day of month
		day = generateRandomNumberInRange(1, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
		
	}
	
	public static int generateRandomNumberInRange(int startRange, int endRange) {
		Random rnd = new Random();
		return rnd.nextInt(endRange - startRange) + startRange;
	}

}
